package com.fourhats.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="productBuyed")
public class ProductBuyed extends com.fourhats.model.Entity {

	public ProductBuyed() {
	}
	
	public ProductBuyed(Product product, User user){
		this.product = product;
		this.user = user;
		this.buyDate = new Date();
	}
	
	@ManyToOne
    @JoinColumn(name="productId")
	private Product product;
	
	@ManyToOne
    @JoinColumn(name="userId")
	private User user;
	
    @Column(name="buyDate")
	private Date buyDate;

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getBuyDate() {
		return buyDate;
	}

	public void setBuyDate(Date buyDate) {
		this.buyDate = buyDate;
	}
}
